<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<template id="ami_customer_invoice">
    <t>
	    <div class="header">
	    	<div class="row">
				<div class="col-xs-4">
                	<img t-if="o.company_id.logo" t-att-src="'data:image/png;base64,%s' % o.company_id.logo" style="max-height: 100px;"/>
            	</div>
            	<div class="col-xs-offset-1">
            		<h3 class="mt0 mb0 ex">CUSTOMER INVOICE</h3>
	           		<h3 class="mt0 mb0"><strong><span t-field="o.company_id.name"/></strong></h3>
             		<h4 class="mt0 mb0"><span t-field="o.company_id.street"/>, <span t-field="o.company_id.street2"/>, <span t-field="o.company_id.city"/>-<span t-field="o.company_id.country_id.name"/>,  <span t-field="o.company_id.zip"/>.</h4>
             		<h4 class="mt0 mb0 redline">Telp: <span t-field="o.company_id.phone"/> Fax: <span t-field="o.company_id.fax"/><span class="ex">------------------------------------</span></h4>
		        </div>
            </div>
            <div class="mt8 mb8 row"/>
		    <div class="row">
		    	<div class="col-xs-2">
	           		<p class="mt0 mb0"><strong>Invoice No. :</strong></p>
             		<p class="mt0 mb0"><strong>Date        :</strong></p>
             		<p class="mt0 mb0"><strong>Due Date    :</strong></p>
             		<br/>
             		<p class="mt0 mb0"><strong>Project     :</strong></p>
             		<p class="mt0 mb0"><strong>PO No.      :</strong></p>
		        </div>
		        <div class="col-xs-4 col-xs-offset-0">
	           		<p class="mt0 mb0" t-field="o.internal_number"/>
             		<p class="mt0 mb0" t-field="o.date_invoice" t-field-options='{"format": "dd/MM/yyyy"}'/>
             		<p class="mt0 mb0" t-field="o.date_due" t-field-options='{"format": "dd/MM/yyyy"}'/>
             		<br/>
             		<p class="mt0 mb0" t-field="o.analytic_contract_id.name"/>
             		<p class="mt0 mb0" t-field="o.name"/>
		        </div>
		        <div class="col-xs-3 col-xs-offset-0">
	           		<p class="mt0 mb0"><strong>To    :</strong></p>
	           		<p class="mt0 mb0"><span class="mt0 mb0" t-field="o.real_partner_id.name"/></p>
	           		<p class="mt0 mb0"><span t-field="o.real_partner_id"
                        t-field-options='{"widget": "contact", "fields": ["address"], "no_marker": true}'/></p>
             		<p class="mt0 mb0"><strong>Attn  : </strong><span class="mt0 mb0" t-field="o.partner_id.name"/></p>
		        </div>
		    </div>
	    </div>
	    
	    <div class="page">
            <div class="oe_structure"/>
            <div class="row">
		    	<h3 class="text-center"><strong>INVOICE</strong></h3>
		    </div>
            <div class="row">
            <table class="table table-condensed">
                <thead>
                    <tr>
                    	<th class="text-center greybgcolor">No.</th>
                        <th class="text-center greybgcolor">Description</th>
                        <th class="text-center greybgcolor">Quantity</th>
                        <th class="text-center greybgcolor">UOM</th>
                        <th class="text-center greybgcolor">Unit Price</th>
                        <th class="text-center greybgcolor">Amount</th>
                    </tr>
                </thead>
				<tbody class="invoice_tbody">
					<t>
						<tr class="kolum" t-if="o.shipyard_data == True">
							<td width="5%"></td>
							<td width="50%">Shipyard</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'shipyard'">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.mechanical_data == True">
							<td width="5%"></td>
							<td width="50%">Mechanical</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'mechanical'">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.electrical_data == True">
							<td width="5%"></td>
							<td width="50%">Electrical</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'electrical'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.welding_data == True">
							<td width="5%"></td>
							<td width="50%">Welding &amp; Fabrication</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'welding_fabrication'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.interior_data == True">
							<td width="5%"></td>
							<td width="50%">Interior</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'interior'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.design_data == True">
							<td width="5%"></td>
							<td width="50%">Design</td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'design'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.other_dept1_data == True">
							<td width="5%"></td>
							<td width="50%"><span t-field="o.dept1_alias"/></td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'other_dept1'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.other_dept2_data == True">
							<td width="5%"></td>
							<td width="50%"><span t-field="o.dept2_alias"/></td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'other_dept2'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t>
						<tr class="kolum" t-if="o.other_dept3_data == True">
							<td width="5%"></td>
							<td width="50%"><span t-field="o.dept3_alias"/></td>
							<td width="8%"/>
							<td width="7%"/>
							<td width="15%"/>
							<td width="15%"/>
	                    </tr>
	                </t>
	                <t t-foreach="o.invoice_line" t-as="l">
						<tr t-if="l.type == 'other_dept3'" class="mt0 mb0">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t>
					<t t-foreach="o.invoice_line" t-as="l">
						<tr class="kolum" t-if="o.shipyard_data == False and o.mechanical_data == False and o.electrical_data == False and o.welding_data == False and o.interior_data == False and o.design_data == False and o.other_dept1_data == False and o.other_dept2_data == False and o.other_dept3_data == False">
							<td width="5%"/>
							<td width="50%"><span>- <span t-field="l.name"/></span></td>
							<td width="8%" class="text-right"><span t-field="l.quantity"/></td>
							<td width="7%"><span t-field="l.uos_id.name"/></td>
							<td width="15%" class="text-right">
	                            <span t-field="l.price_unit"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
	                        <td width="15%" class="text-right">
	                            <span t-field="l.price_subtotal"
	                            	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
	                        </td>
						</tr>
					</t> 
                </tbody>
            </table>
            </div>
            <div class="oe_structure"/>
        </div>
        
        <div class="footer">
			<div class="row signature" style="visibility:hidden;">
				<div class="row col-xs-12 upper-line"></div>
				<div class="col-xs-4 pull-right">
			        <table class="table table-condensed">
			            <tr>
			                <td class="text-right border-all greybgcolor"><strong>Subtotal</strong></td>
			                <td class="text-right border-all">
			                    <strong t-field="o.amount_untaxed" 
			                    		t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
			                </td>
			            </tr>
			            <tr>
			                <td class="text-right border-all greybgcolor"><strong>Discount</strong></td>
			                <td class="text-right border-all">
			                	<strong t-field="o.total_discount"
			                			t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
			                </td>
			            </tr>
			            <tr>
			                <td class="text-right border-all greybgcolor"><strong>Taxes</strong></td>
			                <td class="text-right border-all">
			                    <strong t-field="o.amount_tax" 
			                    		t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
			                </td>
			            </tr>
			            <tr>
			                <td class="text-right border-all greybgcolor"><strong>Total</strong></td>
			                <td class="text-right border-all">
			                     <strong t-field="o.amount_total"
			                     	t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
			                </td>
			            </tr>
			        </table>
		    	</div>
				<div class="col-xs-8">
					<p><span>Remark:</span></p>
					<p class="mt0 mb0">1. Payment term :<span t-field="o.payment_term"></span></p>
					<p class="mt0 mb0">2. All cheques to be crossed and made payable to <strong><span t-field="o.company_id.name"/></strong></p>
					<p class="mt0 mb0"><span>3. Monthly interest of 1.5% will be charged on overdue accounts.</span></p>
				</div>
				<div class="row mt8 mb8"/>
				<div class="col-xs-6 col-xs-offset-0">
					<p class="mt0 mb0"><span>Yours faithfully,</span></p>
					<p class="mt0 mb0"><span t-field="o.company_id.name"/></p>
					<br class="mt0 mb0"/>
					<br class="mt0 mb0"/>
					<p class="mt0 mb0"><span>Electronic signature and stamp</span></p>
					<br class="mt0 mb0"/>
					<p class="mt0 mb0"><span>Accounting Manager</span></p>
				</div>
				<div>
					<p class="mt0 mb0"><span>Received by,</span></p>
					<p class="mt0 mb0"><span t-field="o.partner_id.name"></span></p>
					<br class="mt0 mb0"/>
					<br class="mt0 mb0"/>
					<br class="mt0 mb0"/>
					<p class="mt0 mb0">Name : </p>
					<p class="mt0 mb0">Date : </p>
				</div>
			</div>
        	<div class="row"/>
	        <div class="text-right">
	            <small>
	                <span>Page</span>
	                <strong><span class="page"/></strong>
	                of
	                <strong><span class="topage" /></strong>
	            </small>
	        </div>
	    </div>
	</t>
</template>

<template id="ami_cust_invoice">
    <t t-call="report.html_container">
        <t t-foreach="doc_ids" t-as="doc_id">
            <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang','batam_fast_module.ami_customer_invoice')"/>
        </t>
    </t>
</template>
</data>
</openerp>
